Skip to content

Conversation

@w0rp
Copy link
Member

@w0rp w0rp commented Jul 7, 2025

Summary

  • extend ChatGPT regexes for action verbs in nginx template
  • keep all regex lines under 80 characters
  • add Go tests to ensure ChatGPT routing regex only matches at start of query

Testing

  • go test ./...
  • docker compose up -d (fails: docker not found)

https://chatgpt.com/codex/tasks/task_b_686c225b7d1c832ab5c7707b61e8d526

@w0rp w0rp requested a review from Copilot July 7, 2025 20:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces broad question/instruction regex rules with more precise, start-anchored ChatGPT query patterns for a wider set of verbs and adds Go tests to verify that the ChatGPT routing regex only matches at the start of a query.

  • Replaces legacy unanchored ChatGPT regex entries with multiple ^(verb)\b rules in both nginx.conf and its template.
  • Adds nginx_regex_test.go to extract the generated regexes and test that matches occur only at the beginning of input and not elsewhere.
  • Ensures all regex lines remain under 80 characters.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
nginx.conf Replaced question/instruction mappings with anchored ChatGPT verb rules
cmd/sea/nginx_regex_test.go Added helper to parse the config and tests for start-of-query matching
cmd/sea/nginx.conf.tmpl Updated template to include the same anchored ChatGPT query rules
Comments suppressed due to low confidence (1)

cmd/sea/nginx_regex_test.go:68

  • Consider adding tests for case-insensitive matching (e.g., uppercase verbs) and punctuation boundaries to ensure the regex truly behaves as expected under different input scenarios.
	for _, w := range words {

var patterns []string
lines := strings.Split(conf, "\n")
inBlock := false
re := regexp.MustCompile(`~\*\(\?i\)\^([^\\]+)\\b\s+chatgpt;`)
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The variable name re is quite generic; consider renaming it to something more descriptive like ruleRegex for better readability.

Suggested change
re := regexp.MustCompile(`~\*\(\?i\)\^([^\\]+)\\b\s+chatgpt;`)
ruleRegex := regexp.MustCompile(`~\*\(\?i\)\^([^\\]+)\\b\s+chatgpt;`)

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@w0rp w0rp merged commit 889c886 into main Jul 7, 2025
1 check passed
@w0rp w0rp deleted the codex/extend-routing-functionality-and-refactor-nginx-template-rea branch July 13, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants